<template name='order_money'>
	<view >
		<!-- 商品信息-右边 -->
		<view class="box-infos font13  " >
			<view class="content-box">
				
					<view class="boxsss" >
						<!-- 增加、删除 -->
						<view class="top-but menu-scroll-w" v-if="isPopup==false" style="height: auto;display: block;    margin:  0px;">
							<view class="top-but-box" style="display: block;">

								<!-- 时间 筛选 -->
								<view class="flex floatleft" >
								<text selectable="true"  class="riskTitle">时间范围:</text>
								<view class=" date-center searchBox" >
									
									<picker class="date-left" 
									mode="date" 
									:value="sousou.date.value[0]" 
									@change="changeStartDate"
									>
										<view class="uni-input cursor">{{sousou.date.value.length >0 ? sousou.date.value[0]:'开始时间'}}</view>
									</picker>
									
									<view class="date-c"> - </view>
									
									<picker class="date-left" 
									mode="date" 
									:value="sousou.date.value[1]" 
									@change="changeEndDate"
									>
										<view class="uni-input cursor">{{sousou.date.value.length >1 ? sousou.date.value[1]:'结束时间'}}</view>
									</picker>
									
									<view class="delete-ipu" 
									style="position: unset;transform: none;"
									v-if="sousou.date.value.length >1" 
									@click="sousou.date.value=[],funOrderAllAdmin(true)"
									>
										<img src="../../static/img/delete-1.png"  ></img>
									</view>
								</view>
								</view>
								<!-- end -->
								<!-- 线路 筛选 -->
								<view class="flex floatleft" >
								<text selectable="true"  class="riskTitle ">所属线路:</text>
								<view class="flex searchBox" >
									<view class="input_confirms" >
										<uni-data-select
										:localdata="$routeData.getRoute()"
										v-model="sousou.route.now_id"
										@change="funOrderAllAdmin(true)"
										placeholder="选择线路"
										placeholder-class="placeholder-class"
										class="color-e40318"
										></uni-data-select>
									</view>
								</view>
								</view>
								<!-- end -->
								<!-- 是否过账 筛选 -->
								<view class="flex floatleft" >
									<text selectable="true"  class="riskTitle ">是否过账:</text>
									<view class="input_confirms searchBox">
										<uni-data-select
										:localdata="sousou.accomplish.list"
										v-model="sousou.accomplish.now_id"
										placeholder="是否过账"
										placeholder-class="placeholder-class"
										class="color-e40318"
										@change="funOrderAllAdmin(true)"
										></uni-data-select>
									</view>
								</view>
								<!-- end -->
								
								<!-- 是否打印 筛选 -->
								<view class="flex floatleft" >
								<text selectable="true"  class="riskTitle ">是否打印:</text>
								<view class="input_confirms searchBox">
									<uni-data-select
									:localdata="sousou.isprint.list"
									v-model="sousou.isprint.now_id"
									placeholder="是否打印"
									placeholder-class="placeholder-class"
									class="color-e40318"
									@change="funOrderAllAdmin(true)"
									></uni-data-select>
								</view>
								</view>
								
								<!-- 操作者 筛选 -->
								<view class="flex floatleft" >
									<text selectable="true"  class="riskTitle ">制单人员:</text>
									<view class="input_confirms searchBox">
										<uni-data-select
										:localdata="$routeData.getYuangong()"
										v-model="sousou.YuangongId"
										placeholder="操作者"
										placeholder-class="placeholder-class"
										class="color-e40318"
										@change="funOrderAllAdmin(true)"
										></uni-data-select>
									</view>
								</view>
								<!-- end -->
								
								
								<!-- 订单类型 筛选 -->
								<view class="flex floatleft" >
									<text selectable="true"  class="riskTitle ">订单类型:</text>
									<view class="input_confirms searchBox">
										<uni-data-select
										:localdata="sousou.orderStatus.list"
										v-model="sousou.orderStatus.now_id"
										placeholder="订单类型"
										placeholder-class="placeholder-class"
										class="color-e40318"
										@change="funOrderAllAdmin(true)"
										></uni-data-select>
									</view>
								</view>
								<!-- end -->
								
								
								<!-- 订单类型 筛选 -->
								<view class="flex floatleft" >
									<text selectable="true"  class="riskTitle ">账号类型:</text>
									<view class="input_confirms searchBox">
										<uni-data-select
										:localdata="sousou.supplier.list"
										v-model="sousou.supplier.now_id"
										placeholder="账号类型"
										placeholder-class="placeholder-class"
										class="color-e40318"
										@change="funOrderAllAdmin(true)"
										></uni-data-select>
									</view>
								</view>
								<!-- end -->
								<!-- 账号名称-->
								<view class="flex floatleft" >
									<view class="riskTitle">账号名称:</view>
									<!-- 搜索 -->
									<view class="searchBox" style="min-width: 100px;max-width: 150px;">
										<input 
										v-model="sousou.user_value"
										
										placeholder="输入客户关键字"
										placeholder-class="placeholder-class"
										@confirm="$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)"
										class="search-ipu "
										/>
										<view class="delete-ipu" v-if="sousou.user_value!=''" @click="sousou.user_value='',funOrderAllAdmin(true)">
											<img src="../../static/img/delete-1.png"  ></img>
										</view>
									</view>
										
								</view>
								<!-- end -->
								
								<select_input
								class="floatleft flex"
								title="商品品牌"
								v-model="sousou.brand_name"
								:searchList="selectBrandData.list"
								@change="(res)=>{sousou.brand_id=res}"
								></select_input>
									
									
								
								<!-- 商品名称-->
								<view class="flex floatleft" >
									<view class="riskTitle">商品名称:</view>
									<!-- 搜索 -->
									<view class="searchBox" style="min-width: 100px;max-width: 150px;">
										<input 
										v-model="sousou.goods_value"
										placeholder="输入商品关键字"
										placeholder-class="placeholder-class"
										@confirm="$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)"
										class="search-ipu "
										/>
										<view class="delete-ipu" v-if="sousou.goods_value!=''" @click="sousou.goods_value='',funOrderAllAdmin(true)">
											<img src="../../static/img/delete-1.png"  ></img>
										</view>
									</view>
								</view>
								<!-- end -->
								
								<!-- 订单号-->
								<view class="flex floatleft" >
									<view class="riskTitle">订单号码:</view>
									<!-- 搜索 -->
									<view class="searchBox" style="min-width: 100px;max-width: 150px;">
										<input 
										v-model="sousou.order_id"
										
										placeholder="输入搜索订单号关键字"
										placeholder-class="placeholder-class"
										@confirm="$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)"
										class="search-ipu "
										/>
										<view class="delete-ipu" v-if="sousou.order_id!=''" @click="sousou.order_id='',funOrderAllAdmin(true)">
											<img src="../../static/img/delete-1.png"  ></img>
										</view>
									</view>
								</view>
								<!-- end -->
								
								
								<!-- 订单号-->
								
								<!-- end -->
								
							</view>
							
							<view class="top-but-box" style="">
								<view class="flex floatleft" >
									<view class="riskTitle">利润率低于着色标记:</view>
									<!-- 搜索 -->
									<view class="searchBox" >
										<input 
										v-model="profit_ratio"
										type="number"
										placeholder="输入利润率"
										placeholder-class="placeholder-class"
										class="search-ipu "
										/>
										<view class="delete-ipu" v-if="profit_ratio>0" @click="profit_ratio=15">
											<img src="../../static/img/delete-1.png"  ></img>
										</view>
									</view>
								</view>
								<button
									@click="summary=0,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==0?'#647df7':''}"
									class="nowBut color1" 
								>
									单据明细
								</button>
								
								<button 
									@click="summary=1,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==1?'#647df7':''}"
									class=" nowBut  color2 " 
								>
									客户汇总
								</button>
								
								<button
									@click="summary=2,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==2?'#647df7':''}"
									class="nowBut color3" 
								>
									供应商汇总
								</button>
								
								<button
									@click="summary=3,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==3?'#647df7':''}"
									class="nowBut color4" 
								>
									商品汇总
								</button>
								
								<button
									@click="summary=4,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==4?'#647df7':''}"
									class="nowBut color5" 
								>
									线路汇总
								</button>
								
								<button
									@click="summary=5,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==5?'#647df7':''}"
									class="nowBut color6" 
								>
									制单者汇总
								</button>
								
								<button
									@click="summary=6,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==6?'#647df7':''}"
									class="nowBut color7" 
								>
									订单类型汇总
								</button>
								
								<button
									@click="summary=7,$common.noMultipleClicks('funOrderAllAdmin',funOrderAllAdmin,true)" 
									:style="{'background-color':summary==7?'#647df7':''}"
									class="nowBut color8" 
								>
									品牌汇总
								</button>
								
								<button 
									@click="emptyData()" 
									class="nowBut color9" 
								>
									<img src="../../static/img/delete.png" class="ico"></img>
									重置
								</button>
								
								<button
									@click="openOrderList" 
									class="nowBut color10" 
								>
									汇总表打印
								</button>
								
							</view>
						</view>
						
						
							
						<!-- 明细数据 -->
						<table id="order-money" v-if="resData.summary==0">
							<!-- 表头 -->
							<thead >
								<tr >
									<th style="min-width: 20px;">
										<checkbox
											border-color="#333333" activeborderColor="#333333" 
											:checked="checkbox.select" 
											activeBackgroundColor="#333"
											@click="choose_all"
											style="transform:scale(0.7);"
										/>序
									</th>
									<th class="centers" style="min-width: 20px;" 
										@click="$common.changeColumnColor('order-money',0)">
										打印状态
									</th>
									
									<th class="centers" @click="$common.changeColumnColor('order-money',1)">
										时间
									</th>
									<th @click="$common.changeColumnColor('order-money',2)" class="centers">
										单号
									</th>
									<th class="centers" style="min-width: 20px;" @click="$common.changeColumnColor('order-money',3)">
										过账状态
										
									</th>
									<th @click="$common.changeColumnColor('order-money',4)"class="centers">
										客户
									</th>
									
									
									<th class="centers" style="min-width: 20px;" @click="$common.changeColumnColor('order-money',9)">
										订单类型
									</th>
									
									<th class="centers" @click="$common.changeColumnColor('order-money',5)">
										所属线路
										
									</th>
									<th class="centers" @click="$common.changeColumnColor('order-money',6)">
										价格
									</th>
									<th class="centers" @click="$common.changeColumnColor('order-money',7)">
										利润
									</th>
									<th class="centers" @click="$common.changeColumnColor('order-money',8)">
										利率
									</th>
									<th class="centers">
										操作者
									</th>
									<th class="centers">操作</th>
									<th class="centers">备注</th>
								</tr>
							</thead>
							<tbody>
								<checkbox-group @change="checkbox_change" style="display: contents;">
									<!-- 内容 -->
									<tr v-for="(item,index) in resData.list" 
									:key="index"  
									:class="TabcheckedIndex == index || checkbox.checkbox_status.includes(item.id) ? 'goods-list-select':''"
									@click="TabcheckedIndex = index"
									>
										<td>
											<checkbox
												:value="item.id.toString()" 
												border-color="#333333" activeborderColor="#333333" 
												activeBackgroundColor="#333"
												:checked="checkbox.checkbox_status.includes(item.id)" 
												style="transform:scale(0.7);"
											/>
											{{index+1}}
										</td>
										
										<td  class="centers col-0">
											<view class=" but-sj-erji" :class="item.print_count >0 ? 'order_audit':''">
												{{item.print_count}}
											</view>
										</td>
										
										<td class="centers col-1">{{item.date}}</td>
										<td class="relative col-2">
											{{item.id}}
											<view class="back_data">
												<image src="/static/img/goods_back.png" 
												:title="$global.title.m16" 
												class="ico" 
												v-if="item.back==0"
												></image>
												
												<image src="/static/img/goods_misk.png" 
												:title="$global.title.m17" 
												class="ico" 
												v-if="item.goodsIsProfit"
												></image>
												<image
												src="/static/img/jinggao.png" 
												title="当前单据含有修改批发价的记录" 
												class="ico" 
												v-if="item.moneyUpdateRecord"
												></image>
												<image src="/static/img/order_type.png"
												:title="$global.title.m29" class="ico" 
												v-if="item.order_status==1"
												></image>
												
											</view>
										</td>
										<td class="centers col-3" :class="item.type==2 ?'color-e40318':''">
											{{item.type==2 ? '已过':'未'}}
										</td>
										
										<td class="weight alter col-4"
										@click="pageSend.user_id=item.user.id,pageSend.user_name=item.user.user_name,$refs.page_admin.open()"
										>
											{{item.user_name}}
										</td>
										
										
										<td class="weight col-9 centers" 
										:class="{ff2626:item.order_status==1}"
										:title="item.order_status==0 ? $global.title.m29_1:$global.title.m29">
											{{item.order_status==1?'商城单':'后台单'}}
										</td>
										
										<td class="centers col-5">
											{{item.route_name}}
										</td>
										
										<td 
										class="centers weight col-6"
										:style="{color:item.sum<=0 ? '#ff0000':'#2ab100'}"
										>
											￥{{item.sum}}
										</td>
										
										
										<td class="centers weight col-7" :class="parseFloat(item.profit)<=0 ?'color-e40318':''">
											￥{{item.profit}}
										</td>
										
										
										<td class="centers weight col-8" :class="parseFloat(item.profit_ratio)<=profit_ratio ?'color-e40318':''">
											{{item.profit_ratio}}%
										</td>
										
										<td class="centers" 
										@click="pageSend.user_id=item.uid,pageSend.name=item.uid_name,$refs.page_admin.open()"
										>
											{{item.uid_name}}
										</td>
										
										<td  class="centers alter" @click="$common.GetOrder(item.id,false,2)">
											单据详情
										</td>
										<td  class="centers ">
											<descr :value="item.descr" :order_id="item.id"></descr>
										</td>
									</tr>
								</checkbox-group>
							</tbody>
						</table>
						
						<!-- 其他汇总数据 -->
						<table id="order-money" v-if="resData.summary!=0">
							<!-- 表头 -->
							<thead >
								<tr >
									<th style="min-width: 20px;"class="centers">
										序
									</th>
									<th class="" 
										@click="$common.changeColumnColor('order-money',0)">
										名称
									</th>
									
									<th class="centers" @click="$common.changeColumnColor('order-money',1)">
										<view class="flex centers">
											数量
											<view class="sort-button">
												<view class="desc"  @click="sort.value='countDesc',funOrderAllAdmin(true)"></view>
												<view class="asc"   @click="sort.value='countAsc',funOrderAllAdmin(true)"></view>
											</view>
										</view>
									</th>
									<th @click="$common.changeColumnColor('order-money',2)" class="centers">
										<view class="flex centers">
											金额
											<view class="sort-button">
												<view class="desc"  @click="sort.value='moneyDesc',funOrderAllAdmin(true)"></view>
												<view class="asc"   @click="sort.value='moneyAsc',funOrderAllAdmin(true)"></view>
											</view>
										</view>
										
									</th>
									<th class="centers" style="min-width: 20px;" @click="$common.changeColumnColor('order-money',3)">
										<view class="flex centers">
											利润
											<!-- <view class="sort-button">
												<view class="desc"  @click="sort.value='profitDesc',funOrderAllAdmin(true)"></view>
												<view class="asc"   @click="sort.value='profitAsc',funOrderAllAdmin(true)"></view>
											</view> -->
										</view>
										
										
									</th>
									<th @click="$common.changeColumnColor('order-money',4)"class="centers">
										利润率
										
									</th>
									<th class="centers">
										操作
									</th>
								</tr>
							</thead>
							<tbody>
								
								<!-- 内容 -->
								<tr v-for="(item,index) in resData.list" 
								:key="index"  
								@click="TabcheckedIndex = index"
								:class="TabcheckedIndex == index ? 'goods-list-select':''"
								>
									<td class="centers">
										{{item.number}}
									</td>
									
									<td  class=" col-0" v-if="summary==4">
										{{$routeData.GetRouteItem(item.id).name}}
									</td>
									
									
									<td class="weight col-9 centers"
									v-if="summary==6"
									:class="{ff2626:item.id==1}"
									:title="item.id==0 ? $global.title.m29_1:$global.title.m29">
										{{item.id==1?'商城单':'后台单'}}
									</td>
									
									<td  class=" col-0" v-if="summary!=4 && summary!=6">
										{{item.nickname}}
									</td>
									<td class="centers col-1">
										{{item.count}}
									</td>
									<td class="centers col-2" :style="{color:item.total_money<=0 ? '#ff0000':'#2ab100'}">
										{{item.total_money}}
									</td>
									<td class="centers col-3" :class="parseFloat(item.profit)<=0 ?'color-e40318':''">
										{{item.profit}}
									</td>
									<td class="centers col-4" :class="parseFloat(item.profit_ratio)<=profit_ratio ?'color-e40318':''">
										{{item.profit_ratio}}%
									</td>
									
									<td class="centers alter" @click="openXiangXiOrder(item.nickname,item.id)">
										查看详细
									</td>
								</tr>
						
							</tbody>
						</table>
						<!-- 暂无数据 -->
						<empty v-if="resData.list==undefined || resData.list.length==0"></empty>
						<!-- end -->
					</view>

				<!-- end -->
				<!-- 合计 --><!-- 仅明细可发货操作 -->
				<view class="flex bottom c565656 font12" v-if="summary==0 && resData.list && resData.list.length>0">
					<view class="gz-but add_color" 
					v-if="resData.summary==0"
					@click="$common.noMultipleClicks('fun_order_audit',fun_order_audit)">
						所选单据已发货
					</view>
					<view class="flex">
						<view class="justify">合计: </view>
						<view class="ipu flex border1 ">
							<view class="justify money ">{{resData.data!=undefined ? resData.data.sum:0}}</view>
							<view class="justify">元</view>
						</view>
					</view>
					<view style="height: 1px;width: 20px;"></view>
					<view class="flex">
						<view class="justify">利润: </view>
						<view class="ipu flex border1 ">
							<view class="justify money ">{{resData.data!=undefined ? resData.data.profit:0}}</view>
							<view class="justify">元</view>
						</view>
					</view>
					<view style="height: 1px;width: 20px;"></view>
					<view class="flex">
						<view class="justify">利率: </view>
						<view class="ipu flex border1 ">
							<view class="justify money ">{{resData.data!=undefined ? resData.data.profit_ratio:0}}</view>
							<view class="justify">%</view>
						</view>
					</view>
					<view style="height: 1px;width: 20px;"></view>
					<view class="flex ">
						<view class="justify">计算公式: </view>
						<view class="justify">在指定的筛选条件内所有单据款合计总金额-各个商品的进货价=利润</view>
					</view>
					
				</view>
				<!-- end -->
				
				
				
				<!-- 页码 -->
				<pages 
				:current="page.nowPage"
				:sum="page.sum"
				@updatePage="updatePage"
				></pages>
				<!-- end -->
			</view>
			<!-- 数据列表end -->




			<!-- 用户详情页 -->
			<uni-popup ref="page_admin" type="center" :title="pageSend.name" >
				<person_admin
				:OnPageSearchUserId="pageSend.user_id" 
				status="firm_user_list" 
				class="page-boxs h100"
				></person_admin>	
			</uni-popup>
			<!-- end -->
			
			
			<!-- 详细单据 -->
			<uni-popup ref="order_money" type="center" :title="pageSend.name" height="90%" width="90%">
				<order_money
				:isPopup="true"
				:onSousou="sousous" 
				class="page-boxs h100"
				></order_money>	
			</uni-popup>
			<!-- end -->
			
		</view>
		<!-- end -->
		
		<printList ref="orderPrints"></printList>
	</view>
</template>

<script>
	import pages from "@/components/admin-components/pages.vue"

	import empty from "@/components/admin-components/empty.vue"
	import person_admin from "@/components/user/list.vue"
	import descr from "@/components/descr/descr.vue"
	import printList from "@/components/print_jcp/printList.vue"
	import select_input from "@/components/select_input/input.vue"
	export default{
		name:'order_money',
		components: {
			pages,empty,person_admin,descr,printList,select_input
		},
		beforeCreate(){
			this.$options.components.order_money = require('@/components/admin-components/order_money.vue').default 
		},
		data(){
			return{
				selectBrandData:{
					list:[]
				},
				sort:{
					value:''
				},
				profit_ratio:15,//颜色着色标记
				summary:0,//默认明细单据 其他数字代表汇总
				TabcheckedIndex:-1,//当前选中项
				PrintOrderData:{},//欲要打印的订单数据
				pageSend:{
					user_id:'',
					name:''
				},
				gzTips:"所选单据被执行发货操作后无法修改、删除、增加。请注意。",
				sousou:{
					brand_name:'',
					brand_id:'',
					route:{
						now_id:'',
					},
					supplier:{
						list:[
							{
								value:'',
								text:'不限'
							},
							{
								value:'0',
								text:'客户'
							},
							{
								value:'2',
								text:'供应商'
							},
						],
						now_id:'0',//当前选中
					},
					isprint:{
						list:[
							{
								value:'',
								text:'不限'
							},
							{
								value:'2',
								text:'已打印'
							},
							{
								value:'3',
								text:'未打印'
							},
						],
						now_id:'2',//当前选中
					},
					orderStatus:{
						list:[
							{
								value:'',
								text:'不限'
							},
							{
								value:'1',
								text:'商城单'
							},
							{
								value:'2',
								text:'后台单'
							},
						],
						now_id:'',//当前选中
					},
					
					date:{
						value:[]
					},
					user_value:'',
					uid_value:'',
					goods_value:'',
					order_id:'',
					accomplish:{
						now_id:'',
						list:[//客户的时候线路下拉选择框
							{
								text:'不限',
								value:'',
								disable:false,//是否禁用
							},{
								text:'未过账',
								value:'3',
								disable:false,//是否禁用
							},{
								text:'已过账',
								value:'2',
								disable:false,//是否禁用
							},
						],
					},
					YuangongId:'',
			
				},
				page:{
					
					nowPage:1,//当前页数
					pageCount:1,//总页数
					maxCount:0,
					sum:0,
					pageCounts:15,
				},
				sousous:{},
				resData:{},
				checkbox:{//多选框
					checkbox_status:[],
					select_all:false,
					select:false,
				},
			}
		},
		 // 此处定义传入的数据
		props: {
			/**
			 * 是否弹窗进来的，如果是的话就不展示按钮相关
			*/
			isPopup: {
				type:Boolean,
				default :false
			},
			onSousou:{
				type:Object,
				default :() => {
					return {}
				}
			},
			/**
			 * 其他页面传递进来直接搜寻的，不是菜单打开的
			*/
			OnPageSearchUid: {
				type:String,
				default :''
			},
			/**
			 * 时间范围 开始
			*/
			start_date: {
				type:String,
				default :''
			},
			/**
			 * 时间范围 结束
			*/
			end_date: {
				type:String,
				default :''
			},
			/**
			 * 区分供货商或客户
			*/
			supplier: {
				type:String,
				default :''
			},
			/**
			 * 是否打印的
			*/
			onIsprint: {
				type:String,
				default :''
			},
			/**
			 * 是否过账的
			*/
			onAccomplish: {
				type:String,
				default :''
			},
			/**
			 * 默认线路
			*/
			onRoute: {
				type:String,
				default :''
			},
			
			
		},
		created() {
			this.searchBrand()
			//判断是否有搜索内容，有的话植入，且搜索条件为：只看客户
			if(this.OnPageSearchUid != undefined && this.OnPageSearchUid.length>0){
				this.sousou.uid_value = this.OnPageSearchUid
			}
			
			//判断是有  时间条件
			if(this.start_date != undefined && this.start_date.length>0 && this.end_date != undefined && this.end_date.length>0){
				this.sousou.date.value.push(this.start_date)
				this.sousou.date.value.push(this.end_date)
			}else{
				var date = this.$common.GetFormattedDate()
				this.sousou.date.value.push(date)
				this.sousou.date.value.push(date)
			}
			
			
			this.sousou.accomplish.now_id = this.onAccomplish
			this.sousou.isprint.now_id = this.onIsprint
			this.sousou.supplier.now_id = this.supplier
			
			
			this.sousou.route.now_id = this.onRoute
			
			
			//应该是作为详细单据进来的
			if(this.onSousou.isprint){
				this.sousou = this.onSousou
			}
			this.funOrderAllAdmin(true)
		},
		methods:{
			/**
			 * 搜索品牌
			*/
			searchBrand(){
				var that = this
			
				that.$common.get_request(
					{
						type:'searchBrand',
					},
					(res)=>{
						that.selectBrandData.list = res.list
					}
				);
			},
			openXiangXiOrder(nickname,id){
				if(this.summary==4){
					var name = this.$routeData.GetRouteItem(id).name
				}else if(this.summary==6){
					var name = id==1?'商城单':'后台单'
				}else{
					var name = nickname
				}
				this.pageSend.name = name
				this.user_id = id
				this.sousous = JSON.parse(JSON.stringify(this.sousou))
				if(this.summary == 1 || this.summary == 2){
					this.sousous.uid_value = id
				}
				else if(this.summary == 3){
					this.sousous.goods_value = name
				}
				else if(this.summary == 4){
					this.sousous.route.now_id = id
				}
				else if(this.summary == 5){
					this.sousous.YuangongId = id
				}
				else if(this.summary == 6){
					this.sousous.orderStatus.now_id = id
				}
				else if(this.summary == 7){
					this.sousous.brand_id = id
					this.sousous.brand_name = name
				}
				this.$refs.order_money.open()
			},
			openOrderList(){
				this.$refs.orderPrints.open(this.GetOrderBody())
			},
			//回调第一个时间
			changeStartDate(res){
				this.sousou.date.value[0] = res.detail.value
				this.$set(this.sousou.date.value,0,this.sousou.date.value[0])
				//this.funOrderAllAdmin(true)
			},
			//回调第二个时间
			changeEndDate(res){
				this.sousou.date.value[1] = res.detail.value
				this.$set(this.sousou.date.value,1,this.sousou.date.value[1])
			},
			
			/**
			 * 回调当前选中的表项
			*/
			checkbox_change(e){
				this.checkbox.checkbox_status = e.detail.value
			},
			/**
			 * 全选中
			*/
			choose_all(){
				this.checkbox.checkbox_status = []
				if(this.checkbox.select_all == false){
					this.checkbox.select_all = true
					this.checkbox.select = true
					for (var i=0;i<this.resData.list.length;i++) {
						this.checkbox.checkbox_status.push(this.resData.list[i].id)
					}
				}else{
					this.checkbox.select_all = false
					this.checkbox.checkbox_status = []
					this.checkbox.select = false
				}
			},
			// 取消全选中
			choos_all_close(){
				this.checkbox.select_all = false
				this.checkbox.checkbox_status = []
				this.checkbox.select = false
			},
			
			fun_order_audit(){
				var that = this
				if(that.checkbox.checkbox_status.length==0){
					that.$common.toast("未有选中需要过账的单据，过账失败。")
					return
				}
				uni.showModal({
					content: that.gzTips,
					success: function (res) {
						if (res.confirm) {
							that.checkbox.select = false
							that.fun_user_gz()
						}
					}
				});
			},
			/**
			 * 草稿单-过账
			*/
			fun_user_gz(){
				var that = this
				var arr = [];
				for(var i=0;i<that.checkbox.checkbox_status.length;i++){
					arr.push(that.checkbox.checkbox_status[i])
				}
				var jsonData = JSON.stringify(arr)
				that.$common.get_request(
					{
						type:'user_gz',
						json_data:jsonData,
					},
					(res)=>{
						
						that.$common.toast('成功')
						that.funOrderAllAdmin(false)
					}
				);
			},
			/**
			 * 初始化筛选条件
			*/
			emptyData(){
				this.sousou.user_value=''
				this.sousou.uid_value =''
				this.sousou.date.value =[]
				
				this.sousou.accomplish.now_id=''
				this.sousou.isprint.now_id =''
				this.sousou.route.now_id = ''
				this.sousou.orderStatus.now_id =''
				this.sousou.goods_value = ''
				this.sousou.order_id = ''
				this.sousou.brand_name = ''
				this.sousou.brand_id = ''
				
				this.choos_all_close()
			},
			/**
			 * 线路ID取线路名称
			*/
			routeidGetName(id){
				var tmpArr = this.$routeData.getRoute()
				
				for (var i=0;i<tmpArr.length;i++) {
					if(tmpArr[i].value == id){
						return tmpArr[i].text
					}
				}
				return '-'
			},
			GetOrderBody(isUpdatePage){
				
				//日期构建
				if(this.sousou.date.value.length>=2){
					var start_date = this.sousou.date.value[0]
					var end_date = this.sousou.date.value[1]
				}else{
					var start_date = ''
					var end_date = ''
				}
				this.page.nowPage = isUpdatePage == true ? 1:this.page.nowPage;
				return {
						type:'order_all_admin',
						pages:this.page.nowPage,
						page_count:this.page.pageCounts,//当前请求页的数量
						start_date: start_date,
						end_date: end_date,
						isprint: this.sousou.isprint.now_id,
						goods_value: this.sousou.goods_value,
						user_value: this.sousou.user_value,
						order_id:this.sousou.order_id,
						uid: this.sousou.uid_value,
						route_id:this.sousou.route.now_id,
						accomplish:this.sousou.accomplish.now_id,
						supplier:this.sousou.supplier.now_id,//区分上一个页面传递过来的是客户还是厂家
						status:0,//0=不获取回款记录
						show_goods_list:0,
						yg_id:this.sousou.YuangongId,
						orderStatus:this.sousou.orderStatus.now_id,
						summary:this.summary,
						sort:this.sort.value,
						brand_id:this.sousou.brand_id
				};
			},
			/**
			 * 统计-获取
			*/
			funOrderAllAdmin(isUpdatePage=true){
				var that = this
				that.resData = {}
				var body = this.GetOrderBody(isUpdatePage)
				that.$common.get_request(
					body,
					(res)=>{
						for (var i=0;i<res.list.length;i++) {
							res.list[i].route_name = that.routeidGetName(res.list[i].route_id)
						}
						that.resData = res
						
						that.page.sum  = res.sum
						if(isUpdatePage == true){
						that.page.nowPage  = 1
						}
						that.choos_all_close()
					}
				);
			},
			/**
			 * 分页器回调
			 * 
			*/
			updatePage(pageName,pageCount){
				var that = this
				that.page.nowPage = pageName
				that.page.pageCounts = pageCount
				that.funOrderAllAdmin(false)
			},
		}
	}
</script>

<style>
	.top-but-box .floatleft{
		margin: 5px 10px 5px 0px;
	}
</style>
